home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.2r / card_37512.txt < prev    next >
Text File  |  1989-02-26  |  5KB  |  89 lines

  1. -- card: 37512 from stack: in.2r
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3837
  5. -- name: ReadCat
  6.  
  7.  
  8. -- part contents for background part 5
  9. ----- text -----
  10. ReadCat
  11.  
  12. -- part contents for background part 6
  13. ----- text -----
  14.     The ReadCat XFCN Version 1.5b2 will give you handy access to much of the information in the floppy disk catalogs to use as you see fit in your stacks. You may display the catalog brazenly as I do in my stack, AutoCat 4.0, or you may elect to protect your users from this unpleasantness by using the information as a skeleton for fancy graphic representations.
  15.  
  16.      This XFCN  is entirely in the public domain.  You are encouraged to use it in your own stacks, but take note that while it has been tested thoroughly, it is not guaranteed error free.  Please do not sell the XFCN, and please credit me (my only reward)  when you use it in your stacks.
  17.  
  18.      Also recommended is Auto Floppy Log 3.5 , a HyperCard Disk Catalog.  Available on CompuServe in the HyperCard Forum in DL8 as well as elsewhere in the public domain.
  19.  
  20. Oscar F. Hills              
  21. 34 Maplewood Terrace
  22. Hamden, CT 06514
  23. (203) 287-1913
  24. CIS =>  73317, 3005    GEnie  => O.HILLS
  25.  
  26.      For your information, the ReadCat XFCN requires the following three resources to be installed in your stack (done automatically by the button below):
  27.  
  28. DLOG "ReadCat" ID = 18367
  29. DITL "ReadCat"  ID =  8207
  30. XFCN "ReadCat" ID = 32
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. -- part contents for background part 7
  41. ----- text -----
  42. Syntax:
  43.  
  44. ReadCat()
  45.  
  46. ex:
  47. "put ReadCat() into catbox." 
  48. This will cause HyperCard to prompt the user to insert a floppy disk which will then be read.  The catalog will end up in the variable "catbox" or any other container, in the following format:
  49.  
  50. Line 1: The Volume Name of The Floppy Disk
  51.  
  52. Lines 2 to (The Number of Files and Folders on The Disk):  There will be seven comma delimited items in each line as follows:
  53.  
  54.      Item 1:  Will be either "File" or "Fldr" depending on which it is.
  55.      Item 2:  Will contain the short Date Last Modified of the file.
  56.      Item 3:  The Size of the File in KiloBytes.
  57.      Item 4:  The File Name.
  58.      Item 5:  The Directory ID number (see below).
  59.      Item 6:  The Parent ID number (Yup, parents too, see below).
  60.      Item 7:  The File Type, like "APPL", "TEXT", "STAK"
  61.  
  62.                                                             -ID Numbers -
  63.      Every file and folder has its own ID number. The so-called root directory, i.e., the disk itself, always has an ID number of 2.
  64.      Every file and folder also has a Parent ID number, and this is the same as the ID number of the folder which contains the particular file or folder.  If it is sitting directly on the disk, then the Parent ID number is 2.
  65.      These numbers can help you reconstruct the catalog hierarchy (by the way, under MFS the Parent ID number is always 2), but it is probably wise to prevent your users from actually seeing this sort of thing.
  66.  
  67.                                               - put ReadCat(1) into catbox-
  68.      What if you just want to know what's on the disk?  Using the parameter 1 in the ReadCat XFCN will cause just the file names to be placed into the specified container. The first line will still contain the volume name, however.
  69.  
  70.                                               - put ReadCat(2) into dummy-
  71.      Usually, you will wish to place the information returned by the ReadCat XFCN into fields in your stack.  Having to extract this information item by item in order to apportion it into the proper fields can be very time consuming in HyperTalk.  Using the parameter 2 in the ReadCat XFCN results in the variable being returned empty.
  72.      The good news is that the ReadCat XFCN will try to place each catalog item into eight background fields on the card which calls it. You must create these fields first, and name them exactly as follows:
  73.                                                 Volume
  74.                                                 Object Type
  75.                                                 Date
  76.                                                 Size
  77.                                                 File Name
  78.                                                 Directory ID
  79.                                                 Parent ID
  80.                                                 File Type
  81.  
  82.      These background fields will then contain the information as described above. The field "Volume" will contain the disk's name, and the other background fields, which should probably be scrolling fields if they are to be visible, will contain lists of each of the other seven items described earlier.
  83.  
  84.  - put ReadCat(2,0,0,0,0,0,0,0,0) into dummy-
  85.      Now, of course, you may not wish to waste time and space storing information you do not need.  In this case, the parameter 2 may be accompanied by eight additional parameters.  Each of these represents one of the eight background fields described above. A zero will cause the field to be ignored (you wouldn't even need to create the background field) while a 1 will cause the appropriate information to be placed into the background field.  For example, if you wished the function to return only the Date Last Modified, the File Size, and the File Name to those fields you would use the line "put ReadCat(2,0,0,1,1,1,0,0,0) into dummy." 
  86.  
  87. -- part contents for background part 10
  88. ----- text -----
  89. 42